// .txt

beginzonescript;

variables;

short im_hostile = 0;
short last_abil;
short counter = 0;
short set_ter1 = 0;

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

	set_name(30001,"Lithan Worker");
	set_name(30002,"Lithan Worker");

	if (gf(12,11) > 0)
		erase_char(30001);
		else erase_char(30002);

	set_name(1223,"Tihomir");
		
//	set_attack_range(,);

//	add_ability(short which_char_or_group,short which_slot,short which_ability,0);

	if (gf(12,11) > 0)
		erase_char(1232);
	sf(12,13,0);
	
//	if (is_town_clear(ME))
//		clean_up_town();

	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	//if ((set_ter1 == 0) && (gf(0,0) > 0)) {
	//	set_ter1 = 1;
	//	set_terrain(,,,);
	//	}
	
	if ((party_dist_to_spot(22,3) <= 8) && (char_ok(1232))) {
		sf(12,13,2);
		erase_char(1232);
		spawn_creature(1255);
		}
	
	if ((on_which_layer() == 1) && (gf(12,19) == 0) && (gf(12,13) == 1)) {
		sf(12,19,1);
		activate_hidden_group(1);
		}
		
	if (gf(12,11) == 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(1223,"We are haunted.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(1223,"A Misttalker is here.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(1223,"Hello, Haven.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(1223,"You may pass.");
		}
	if (gf(12,11) > 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(1223,"Things are better now.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(1223,"We are safe for now.");
		}

	//if (gf(,) < 2) {
	//	inc_flag(,,1);
	//	if (gf(,) == 2)
	//		begin_talk_mode();
	//	}

	//if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_town()) && (tick_difference(last_abil,get_current_tick()) > 5))) {
	//	last_abil = get_current_tick();
	//	}
break;

beginstate 10;
sf(12,20,1);
break;

beginstate 11;
break;

beginstate 12;
break;

beginstate 13;
break;

//	print_str("");
//	set_terrain_string_range(".",1);
//	set_terrain_string_range("The sign says - .",1);
